package com.entity;

import java.util.List;

/**
 * @ProjectName: shop
 * @Author: Jsx
 * @Time: 2020/8/30 21:22
 * @Description:
 */
public class PageBean<T> {

    private int currentPage; //当前页数
    private int pageSize; //页容量
    private long totalCount;//总条数
    private int totalPage; //总页数
    private List<T> data;

    public PageBean() {
    }

    public PageBean(int currentPage, int pageSize, long totalCount, List<T> data) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.data = data;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPage() {

        return (int) Math.ceil(totalCount*1.0/pageSize);
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }
}